import os
from pathlib import Path
from dotenv import load_dotenv

# 加载环境变量
load_dotenv()

# 基础配置
class Settings:
    PROJECT_NAME: str = "BIM IFC to JSON Converter"
    PROJECT_VERSION: str = "1.0.0"

    # 文件路径配置
    BASE_DIR = Path(__file__).resolve().parent.parent
    DATA_DIR = BASE_DIR / "data"
    INPUT_DIR = DATA_DIR / "input"
    OUTPUT_DIR = DATA_DIR / "output"

    # 确保目录存在
    INPUT_DIR.mkdir(parents=True, exist_ok=True)
    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)

    # API配置
    API_PREFIX = "/api"
    DOCS_URL = "/docs"

    # 安全配置（从环境变量读取）
    SECRET_KEY: str = os.getenv("SECRET_KEY", "your-secret-key-here")
    ALGORITHM: str = os.getenv("ALGORITHM", "HS256")

    # 文件上传限制
    MAX_FILE_SIZE: int = 1024 * 1024 * 100  # 100MB
    ALLOWED_FILE_TYPES: list = [".ifc"]
    
    # Coze配置
    COZE_API_TOKEN: str = os.getenv("COZE_API_TOKEN", "")
    COZE_WORKFLOW_ID: str = os.getenv("COZE_WORKFLOW_ID", "7543827575640195072")

settings = Settings()